$(function () {
    if (typeof ClipboardJS != 'function') {
        return false; /*避免未引入Clipboard抛错*/
    }

    var clipboard = new ClipboardJS('a', {
        text: function (obj) {
            var txt = $(obj).attr('data-clipboard-text');
            if (txt === '' || txt === undefined) {
                txt = '';
            }
            return txt;
        }
    });
    clipboard.on('success', function (e) {
        console.log("success");
    });
});

//默认提交状态为false
var commitStatus = false;
function doSubmit() {
    var key = $('input[name=key]').val();
    if (key == '') {
        window.location = '/';
        return false;
    }
    if (commitStatus == false) {
        //提交表单后，将提交状态改为true
        commitStatus = true;
        return true;
    } else {
        return false;
    }
}